home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
Dots & Pixels
/
sources
/
window.cp
< prev
Wrap
Text File
|
1995-09-29
|
2KB
|
75 lines
#include <Windows.h>
#include <QDOffscreen.h>
#include <Fonts.h>
#include <Packages.h>
#include <SegLoad.h>
#include <ToolUtils.h>
#include <TextEdit.h>
#include "general.h"
#include "port.h"
#include "window.h"
window::window( short breedte, short hoogte, Str255 naam) : port()
{
SetRect( &myRect, 0, 0, breedte, hoogte);
Rect theRect = myRect;
short * const MBarHeight = (short *)0x0BAA;
const short offset = 2 * (*MBarHeight);
OffsetRect( &theRect, offset, offset); // moves window from below menubar (on most systems)
makeOne( theRect, naam);
}
window::window( short breedte, short hoogte, short xPos, short yPos, Str255 naam)
{
SetRect( &myRect, 0, 0, breedte, hoogte);
Rect theRect = myRect;
OffsetRect( &theRect, xPos, yPos);
makeOne( theRect, naam);
}
void window::makeOne( const Rect &theRect, const Str255 naam)
{
myWindow = NewCWindow( &myWindowRecord, &theRect, naam, 0, 0, (WindowPtr)-1, 1, 0);
show();
SetPort( myWindow);
GetGWorld( &myGWorldPtr, &myGDHandle);
#ifndef _APPL_
#ifndef THINK_CPLUS
//
// signal 'application' to close this window on exit
//
SetWRefCon( myWindow, 'vens');
#endif
#endif
myRect = myWindow->portRect;
myPix = (PixMapPtr)(&(myWindow->portBits));
}
window::~window()
{
CloseWindow( myWindow); // we passed our own WindowRecord => don't call DisposeWindow
}
void window::show() const
{
ShowWindow( myWindow);
SelectWindow( myWindow);
}
void window::hide() const
{
HideWindow( myWindow);
}
void window::moveto( int x, int y) const
{
MoveWindow( myWindow, x, y, false); // do not make this the active window
}